package com.pat.web.model;

import java.math.BigDecimal;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.jfinal.plugin.activerecord.Record;

public class RecordDetails {

	private Long id;

	private Long projectId;

	private Long noteId;

	private Integer projectType;

	private String projectName;

	private String projectIcon;

	private Date createTime;

	private String remark;

	private BigDecimal amount;

	private String unit;

	private String pic1;

	private String pic2;

	private String pic3;

	private String pic4;

	private String pic5;

	private String pic6;

	private Map<String, String> pics;

	private String cautionInfo;

	public RecordDetails() {
	}

	public RecordDetails(Record record) {
		this.id = record.getLong("id");
		Long projectId = record.getLong("projectId");
		if (projectId != null) {
			this.projectId = projectId;
		}
		Long project_id = record.getLong("project_id");
		if (project_id != null) {
			this.projectId = project_id;
		}
		Long noteId = record.getLong("nid");
		if (noteId != null) {
			this.noteId = noteId;
		}
		Long note_id = record.getLong("note_id");
		if(note_id != null){
			this.noteId = note_id;
		}
		this.projectType = record.getInt("project_type");
		this.projectName = record.getStr("project_name");
		this.projectIcon = record.getStr("project_icon");
		this.createTime = record.getDate("create_time");
		this.remark = record.getStr("remark");
		this.amount = record.getBigDecimal("amount");
		this.unit = record.getStr("unit");
		pics = new LinkedHashMap<String, String>();
		this.pic1 = record.getStr("pic1");
		this.pic2 = record.getStr("pic2");
		this.pic3 = record.getStr("pic3");
		this.pic4 = record.getStr("pic4");
		this.pic5 = record.getStr("pic5");
		this.pic6 = record.getStr("pic6");
		if (StringUtils.isNotBlank(pic1)) {
			pics.put("pic1", pic1);
			pic1 = null;
		}
		if (StringUtils.isNotBlank(pic2)) {
			pics.put("pic2", pic2);
			pic2 = null;
		}
		if (StringUtils.isNotBlank(pic3)) {
			pics.put("pic3", pic3);
			pic3 = null;
		}
		if (StringUtils.isNotBlank(pic4)) {
			pics.put("pic4", pic4);
			pic4 = null;
		}
		if (StringUtils.isNotBlank(pic5)) {
			pics.put("pic5", pic5);
			pic5 = null;
		}
		if (StringUtils.isNotBlank(pic6)) {
			pics.put("pic6", pic6);
			pic6 = null;
		}
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getProjectId() {
		return projectId;
	}

	public void setProjectId(Long projectId) {
		this.projectId = projectId;
	}

	public Long getNoteId() {
		return noteId;
	}

	public void setNoteId(Long noteId) {
		this.noteId = noteId;
	}

	public Integer getProjectType() {
		return projectType;
	}

	public void setProjectType(Integer projectType) {
		this.projectType = projectType;
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	public String getProjectIcon() {
		return projectIcon;
	}

	public void setProjectIcon(String projectIcon) {
		this.projectIcon = projectIcon;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public BigDecimal getAmount() {
		return amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public String getPic1() {
		return pic1;
	}

	public void setPic1(String pic1) {
		this.pic1 = pic1;
	}

	public String getPic2() {
		return pic2;
	}

	public void setPic2(String pic2) {
		this.pic2 = pic2;
	}

	public String getPic3() {
		return pic3;
	}

	public void setPic3(String pic3) {
		this.pic3 = pic3;
	}

	public String getPic4() {
		return pic4;
	}

	public void setPic4(String pic4) {
		this.pic4 = pic4;
	}

	public String getPic5() {
		return pic5;
	}

	public void setPic5(String pic5) {
		this.pic5 = pic5;
	}

	public String getPic6() {
		return pic6;
	}

	public void setPic6(String pic6) {
		this.pic6 = pic6;
	}

	public Map<String, String> getPics() {
		return pics;
	}

	public void setPics(Map<String, String> pics) {
		this.pics = pics;
	}

	public String getCautionInfo() {
		return cautionInfo;
	}

	public void setCautionInfo(String cautionInfo) {
		this.cautionInfo = cautionInfo;
	}
}
